#include <stdint.h>
#include "mem_pool.h"

int main(void) {
  InnoMemPool pool;
  mem_pool_init(&pool);

  uint8_t* ptr1 = (uint8_t*)mem_pool_alloc(&pool);
  uint8_t* ptr2 = (uint8_t*)mem_pool_alloc(&pool);
  uint8_t tmp_idx = 0;

  if ((ptr1 != NULL) && (ptr2 != NULL)) {
    for (; tmp_idx < INNO_MEM_BLOCK_SIZE; ++tmp_idx) {
      ptr1[tmp_idx] = tmp_idx;
      ptr2[tmp_idx] = 2 * tmp_idx;
    }

    inno_log_info("%s", "Data stored in ptr1:\n");
    tmp_idx = 0;
    for (; tmp_idx < INNO_MEM_BLOCK_SIZE; ++tmp_idx) {
      inno_log_info("%d ", ptr1[tmp_idx]);
    }

    inno_log_info("%s", "Data stored in ptr2:\n");
    tmp_idx = 0;
    for (; tmp_idx < INNO_MEM_BLOCK_SIZE; ++tmp_idx) {
      inno_log_info("%d ", ptr2[tmp_idx]);
    }

    mem_pool_free(&pool, ptr1);
    mem_pool_free(&pool, ptr2);
  } else {
    inno_log_error("%s", "Memory allocation failed.\n");
  }

  return 0;
}
